<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 使用 v-on:事件名=触发结果   绑定事件 -->
    <div id="div">
        <button v-on:click="data--">-</button>
        <div>{{data}}</div>
        <button v-on:click="data++">+</button>
    </div>
    <!--可以将v-on:替换为@，这样写更方便-->
    <div id="div">
        <button @click="data--">-</button>
        <div>{{data}}</div>
        <button @click="data++">+</button>
    </div>
    <!--  触发结果可以使用methods中的函数名-->

    <div id="div">
        <button @click="fn">-</button>
        <div>{{data}}</div>
        <button @click="fn">+</button>
    </div>



</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    const app = new Vue({
        el: '#div',
        data: {
            data: 100
        },
        methods: {
            fn() {
                console.log(666);
            }
        }
    })
</script>

</html>